﻿Imports FluentNHibernate.Mapping

Public Class OrderMap
    Inherits ClassMap(Of nHibernate.Models.OrderModel)

    Public Sub New()
        '### Basic Properties ###'
        Id(Function(x) x.UniqueID)
        Map(Function(x) x.OrderID)
        Map(Function(x) x.DokumentArt)
        Map(Function(x) x.Datum)
        Map(Function(x) x.ReductionAmount)
        Map(Function(x) x.ReductionText)
        Map(Function(x) x.Rebate)
        Map(Function(x) x.LinkedFromOffer)
        Map(Function(x) x.LinkedToOffer)
        Map(Function(x) x.LinkedFromCredit)
        Map(Function(x) x.LinkedToCredit)
        Map(Function(x) x.LinkedFromDelivery)
        Map(Function(x) x.LinkedToDelivery)
        Map(Function(x) x.LinkedFromInvoice)
        Map(Function(x) x.LinkedToInvoice)
        Map(Function(x) x.OrderText)
        Map(Function(x) x.TextBefore)

        '### References ###'
        References(Function(x) x.Customer).Not.LazyLoad()
        HasMany(Function(x) x.OrderedArticles).Not.LazyLoad()
        References(Function(x) x.PaymentMethode).Not.LazyLoad()
        References(Function(x) x.DeliveryAddress).Not.LazyLoad()
        References(Function(x) x.LastEditBy).Not.LazyLoad()

        '### For Preview Model ###'
        Map(Function(x) x.TotalValueAmount)
        Map(Function(x) x.TotalValueCurrency)
        Map(Function(x) x.CustomerNamePreview)
    End Sub
End Class
